package com.sharp.wechat.dao.repository;

import com.sharp.kernel.mybatis.repository.BaseMysqlRepository;
import com.sharp.wechat.dao.entity.MmOpenidMap;
import com.sharp.wechat.dao.mapper.MmOpenidMapDao;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;

/**
 * Title: MmOpenidMapService
 * Description: Copyright: Copyright (c) 2019 Company: BHFAE
 *
 * @author Sharp
 * @date 2020/6/17 11:00
 */
@Service
public class MmOpenidMapService extends BaseMysqlRepository<MmOpenidMap, MmOpenidMapDao> {

    @Resource
    private MmOpenidMapDao mmOpenidMapDao;

    public MmOpenidMap getOpenidMapByUnionId(String unionId) {
        Example example = super.getExample();
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("unionId", unionId);
        return super.selectOne(example);
    }

    public MmOpenidMap getOpenidMapByOpenId(String openId) {
        Example example = super.getExample();
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("openId", openId);
        return super.selectOne(example);
    }

    @Override
    protected MmOpenidMapDao getDao() {
        return mmOpenidMapDao;
    }
}





